import java.util.Objects;
import java.util.regex.Pattern;

class Bob {

    String hey(final String inputString) {
        if (inputString.replaceAll(" ", "").equals("")) {
            return "Fine. Be that way!";
        }

        if (Pattern.compile("[A-Z]+").matcher(inputString).find()
                && Objects.equals(inputString.toUpperCase(), inputString)) {
            return "Whoa, chill out!";
        }

        if (inputString.lastIndexOf("?") == inputString.length() - 1) {
            return "Sure.";
        }

        return "Whatever.";
    }
}